package com.yu.admin.modules.system.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yu.admin.common.annotation.NeedPermission;
import com.yu.admin.modules.system.pojo.LoginLog;
import com.yu.admin.modules.system.service.impl.LoginLogServiceImpl;
import com.yu.common.util.result.R;
import com.yu.common.exception.ServiceException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Api(tags = "系统：后台登录日志管理")
@RestController
@RequestMapping("/api-system/loginLog")
public class LoginLogController {

    @Resource
    private LoginLogServiceImpl loginLogService;

    @ApiOperation("分页查询")
    @NeedPermission("system:loginLog:list")
    @GetMapping("/page")
    public R<Page<LoginLog>> getLoginLogByPage(
            @ApiParam("页数") @RequestParam(defaultValue = "1") int pageNo,
            @ApiParam("页面大小") @RequestParam(defaultValue = "10") int pageSize) throws ServiceException {
        return R.ok(loginLogService.getLoginLogByPage(pageNo, pageSize));
    }
}
